<%@ page language="java" 
    pageEncoding="UTF-8"%>
<%--导入核心标签库--%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html>

	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>订单详情</title>
		<link rel="stylesheet" href="${pageContext.request.contextPath}/css/bootstrap.min.css" type="text/css" />
		<script src="${pageContext.request.contextPath}/js/jquery-3.4.1.min.js" type="text/javascript"></script>
		<script src="${pageContext.request.contextPath}/js/bootstrap.min.js" type="text/javascript"></script>
		
		<link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css" type="text/css" />
		<style>
			body {
				margin-top: 20px;
				margin: 0 auto;
			}
			
			.carousel-inner .item img {
				width: 100%;
				height: 300px;
			}
		</style>
	</head>

	<body>

	<%--导入头部页面--%>
	<%@include file="/jsp/header.jsp"%>


		<div class="container">
			<div class="row">

				<div style="margin:0 auto;margin-top:10px;width:950px;">
					<strong>订单详情</strong>
					<table class="table table-bordered">
						<tbody>
							<tr class="warning">
								<th colspan="5">订单编号:${bean.oid} </th>
							</tr>
							<tr class="warning">
								<th>图片</th>
								<th>商品</th>
								<th>价格</th>
								<th>数量</th>
								<th>小计</th>
							</tr>

							<%--遍历所有的订单项的数据--%>
							<c:forEach items="${bean.items}" var="item">
								<tr class="active">
									<td width="60" width="40%">
										<input type="hidden" name="id" value="22">
										<img src="${pageContext.request.contextPath}/${item.product.pimage}" width="70" height="60">
									</td>
									<td width="30%">
										<a target="_blank">${item.product.pname}</a>
									</td>
									<td width="20%">
										￥${item.product.shop_price}
									</td>
									<td width="10%">
										${item.count}
									</td>
									<td width="15%">
										<span class="subtotal">￥${item.subtotal}</span>
									</td>
								</tr>
							</c:forEach>

						</tbody>
					</table>
				</div>

				<div style="text-align:right;margin-right:120px;">
					商品金额: <strong style="color:#ff6600;">￥${bean.total}元</strong>
				</div>

			</div>

			<div>
				<hr/>
				<form id="confirmForm" class="form-horizontal" style="margin-top:5px;margin-left:150px;"
					  action="${pageContext.request.contextPath}/order?methodName=pay" method="post">
					<%--隐藏域--%>
					<input  type="hidden" name="oid" value="${bean.oid}" />
					<div class="form-group">
						<label for="address" class="col-sm-1 control-label">地址</label>
						<div class="col-sm-5">
							<input type="text" class="form-control" name="address" id="address" placeholder="请输入收货地址">
						</div>
					</div>
					<div class="form-group">
						<label for="username" class="col-sm-1 control-label">收货人</label>
						<div class="col-sm-5">
							<input type="text" class="form-control" name="name" value="${bean.user.name}" id="username" >
						</div>
					</div>
					<div class="form-group">
						<label for="telephone" class="col-sm-1 control-label">电话</label>
						<div class="col-sm-5">
							<input type="text" name="telephone"  class="form-control" id="telephone" placeholder="请输入联系方式">
						</div>
					</div>
				</form>

				<hr/>

				<div style="margin-top:5px;margin-left:150px;">
					<strong>支付方式</strong>
					<p>


					</p>
					<hr/>
					<p style="text-align:right;margin-right:100px;">
						<a href="javascript:void(0)">
							<input type="button" value="支付宝支付" onclick="payOrder()" class="btn-primary btn-lg">
						</a>
					</p>
					<hr/>

				</div>
			</div>

		</div>

		<div style="margin-top:50px;">
			<img src="${pageContext.request.contextPath}/image/footer.jpg" width="100%" height="78" alt="我们的优势" title="我们的优势" />
		</div>

		<div style="text-align: center;margin-top: 5px;">
			<ul class="list-inline">
				<li><a>关于我们</a></li>
				<li><a>联系我们</a></li>
				<li><a>招贤纳士</a></li>
				<li><a>法律声明</a></li>
				<li><a>友情链接</a></li>
				<li><a target="_blank">支付方式</a></li>
				<li><a target="_blank">配送方式</a></li>
				<li><a>服务声明</a></li>
				<li><a>广告声明</a></li>
			</ul>
		</div>
		<div style="text-align: center;margin-top: 5px;margin-bottom:20px;">
			Copyright &copy;2020-2030  Rice mall
		</div>

	</body>
<script>

		//提交订单,触发表单提交事件
	function payOrder() {
		// alert("点击事件触发") ;
		//获取form的标签对象
		var formObj = document.getElementById("confirmForm") ;
		formObj.submit() ;
	}
</script>

</html>